﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<title>现金表-简易财务现金流水账</title>
	<link rel="stylesheet" href="/static/login/css/style.css" />
	<link rel="stylesheet" href="/static/login/css/icon.css" />
        <link rel="stylesheet" href="__LIBS__/layui/css/layui.css">
</head>

<body>
<div id="wrapper">
	<div class="aw-login-box">
    	<div class="box-bg-ys"></div>
		<div class="mod-body clearfix">
			<div class="content pull-left">
				<h1 class="logo"><a href=""></a></h1>				
                                <form id="login_form" class="layui-form" action="{:url('user/index/login')}" method="post">
					<input type="hidden" name="return_url" value="0">
					<ul>
						<li>
							<input type="text" id="username" class="form-control" placeholder="用户名/手机号码" name="username" autocomplete="off">
						</li>
						<li>
							<input type="password" id="password" class="form-control" placeholder="密码" name="password">
						</li>
						<!-- <li class="alert alert-danger hide error_message">
							<i class="icon icon-delete"></i> <em></em>
						</li> -->
						<li class="last">
                                                        <button class="pull-right btn btn-large btn-primary" lay-submit lay-filter="login"/>登 录</button>
							<label>
                                                            <input type="checkbox" name="remember_user" id="remember_user" checked title="记住密码">
							</label>
						</li>
					</ul>
				</form>
			</div>
			<div class="side-bar pull-left">
				<h3>第三方账号登录</h3>
				<a href="#" class="btn btn-block btn-weibo"><i class="icon icon-weibo"></i> 新浪微博登录</a>
				<a href="#" class="btn btn-block btn-qq"> <i class="icon icon-qq"></i> QQ登录</a>
			</div>
		</div>
		<div class="mod-footer">
			<span>还没有账号?</span>&nbsp;&nbsp;
			<a href="javascript:;">立即注册</a>&nbsp;&nbsp;•&nbsp;&nbsp;
			<a href="javascript:;">游客访问</a>&nbsp;&nbsp;		
		</div>
	</div>
</div>
</body>
<script src="__USER__/login/js/jquery.js"></script>
        <script src="/static/js/jquery.cookie.js"></script>
        <script src="__LIBS__/layui/layui.js"></script>
       
        <script>
            layui.use(['layer', 'form', 'jquery'], function(){
                var layer = layui.layer,
                    form  = layui.form,
                    $     = layui.jquery;

                form.on('submit(login)', function(data) {
                    var index = layer.msg('登录中，请稍候', {
                        icon: 16,
                        time: false,
                        shade: 0.3
                    });
                    if ($("#remember_user").prop("checked") == true) {
                            var user_name = $("#username").val();
                            var user_password = $("#password").val();
                            $.cookie("remember_user", "true", {
                                    expires: 7
                            }); // 存储一个带7天期限的 cookie
                            $.cookie("user_name", user_name, {
                                    expires: 7
                            }); // 存储一个带7天期限的 cookie
                            $.cookie("user_password", user_password, {
                                    expires: 7
                            }); // 存储一个带7天期限的 cookie
                    } else {
                            $.cookie("remember_user", "false", {
                                    expires: -1
                            }); // 删除 cookie
                            $.cookie("user_name", '', {
                                    expires: -1
                            });
                            $.cookie("user_password", '', {
                                    expires: -1
                            });
                    }
                    $.ajax({
                        url: data.form.action,
                        type: data.form.method,
                        dataType: 'json',
                        data: $(data.form).serialize(),
                        success: function(result) {
                            if (result.code === 1) {
                                location.href = result.url;
                            } else {
                                $('.captcha img').attr('src', '{:url("user/index/captcha")}?rand='+Math.random());
                                layer.close(index);
                                layer.msg(result.msg);
                            }
                        },
                        error: function (xhr, state, errorThrown) {
                            layer.close(index);
                            layer.msg(state + '：' + errorThrown);
                        }
                    });

                    return false;
                });
                //

            });

        </script>
        <script>
            $(function() {
                if ($.cookie("remember_user")) {
                        $("#remember_user").prop("checked", true);
                        $("#username").val($.cookie("user_name"));
                        $("#password").val($.cookie("user_password"));
                        // 输入框内容变化按钮颜色发生变化
                        $(".form-data input").siblings("label").hide();
                        $(".log-btn").removeClass("off")
                }
        });

        function saveUserInfo() {

        }
        </script>
</html>